home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / fastkey.exe / C_DEMO.CPP next >
C/C++ Source or Header  |  1992-12-11  |  857b  |  34 lines

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include "fastkey.h"
  4.  
  5. /*──────────────────────────────────────────────────────────────────────────*/
  6. /* Purpose:  To demonstrate the advantages of FASTKEY over the standard     */
  7. /*           method of checking the keyboard.                               */
  8. /*──────────────────────────────────────────────────────────────────────────*/
  9.  
  10. void main() {
  11.   int X=40, Y=20;
  12.   char line[80];
  13.  
  14.   clrscr();
  15.   printf("FastKey Demonstration - For Borland C++.  Press Esc to exit.");
  16.  
  17.   InstallFastKey();
  18.  
  19.   while(!Pressed(FKEsc)) {
  20.     gotoxy(X,Y); cputs("X");
  21.     if (Pressed(FKLeft) && !Pressed(FKRight)) {
  22.       gotoxy(X,Y); cputs(" ");
  23.       if (X > 1) X--;
  24.     };
  25.     if (Pressed(FKRight) && !Pressed(FKLeft)) {
  26.       gotoxy(X,Y); cputs(" ");
  27.       if (X < 79) X++;
  28.     };
  29.   };
  30.  
  31.   UnInstallFastKey();
  32.  
  33.   clrscr();
  34. };